﻿using LS.Entitys;
using System.Collections.Generic;

namespace LS.Cores
{
    /// <summary>
    /// 用户登录管理自定义方法
    /// </summary>
    public interface ISysUser : IRepositoryBase<SysUserEntity>
    {
        /// <summary>
        /// 用户登录
        /// </summary>
        /// <param name="name"></param>
        /// <param name="pwd"></param>
        /// <returns></returns>
        SysUserEntity Login(string name, string pwd);
        
        /// <summary>
        /// 用户是已存在
        /// </summary>
        /// <param name="account"></param>
        /// <returns></returns>
        bool ExistAccount(string account);

        /// <summary>
        /// 角色用户关系
        /// </summary>
        /// <param name="strwhere"></param>
        /// <returns></returns>
        List<SysUserRoleEntity> GetRoleUser(string strwhere);



        /// <summary>
        /// 增加用户
        /// </summary>
        /// <param name="model"></param>
        /// <param name="userroleList"></param>
        /// <param name="userorgList"></param>
        /// <returns></returns>
        int InsertUser(SysUserEntity model, List<SysUserRoleEntity> userroleList,List<SysOrganizeUserEntity> userorgList);

        /// <summary>
        /// 修改用户
        /// </summary>
        /// <param name="model"></param>
        /// <param name="userroleList"></param>
        /// <param name="userorgList"></param>
        /// <returns></returns>
        int UpdateUser(SysUserEntity model,  List<SysUserRoleEntity> userroleList, List<SysOrganizeUserEntity> userorgList);

        /// <summary>
        /// 修改用户状态
        /// </summary>
        /// <param name="uids"></param>
        /// <param name="enable">0=禁用 1= 可用</param>
        /// <returns></returns>
        int UpdateEnable(long id, int enable);


        /// <summary>
        /// 修改用户密码
        /// </summary>
        /// <param name="id"></param>
        /// <param name="pwd"></param>
        /// <returns></returns>
        int UpdatePwd(long id, string pwd);

        /// <summary>
        /// 修改用户头像
        /// </summary>
        /// <param name="id"></param>
        /// <param name="pwd"></param>
        /// <returns></returns>
        int UpdateAvater(long id, string avatar);

        /// <summary>
        /// 修改用户审核状态
        /// </summary>
        /// <param name="ids"></param>
        /// <returns></returns>
        int AuditUser(string ids);

        /// <summary>
        ///审核授权用户 角色 机构
        /// </summary>
        /// <param name="userroleList"></param>
        /// <param name="userorgList"></param>
        /// <returns></returns>
        int InsertAuditUser( List<SysUserRoleEntity> userroleList, List<SysOrganizeUserEntity> userorgList);
    }
}